<?php defined('SYSPATH') or die('No direct script access.');
$mydatetime	= Helper_MyDateTime::factory();
$arraylist	= Helper_ArrayList::factory();
$display		= Helper_DisplayItems::factory();
$thesystems		= Helper_thesystems::factory();

$r = Request::current();
$action = $r->uri2();

$check_proddetail = $thesystems->system_auth('module_products_detail_type');
$mode = Arr::get($_REQUEST,'mode');
?>

<style type="text/css">
.td-manage-small{
	width: 50px; 
}
.td-manage-long{
	width: 80px; 
}
</style>
<?php if($mode != 'print') { ?>
<?php 
	echo View::factory('module/apps_breadcrumb')
		->set('breadcrumbs',
			array(
				0=>array(
					'address'=>'index',
					'text'=>'Dashboard'
				),
				1=>array(
					'address'=>NULL,
					'text'=>"Report Product"
				)
			)
		)
		->render();
?>

<?php echo View::factory('module/apps_message')->render(); ?>
<?php } ?>
<!-- Forms Starts -->
<div class="row-fluid">
		<!-- Product Table Starts -->
		<div class="row centered-margin">		
			<div class="box">
				<div class="box-content">
					<table class="table table-bordered table-striped table-condensed table-hover">
					  <thead>
						  <tr>
						  	<th>No.</th>
							  <th>Code</th>
							  <th>Name</th>
							  <th>Price 1</th>
							  <th>Price 2</th>
							  <th>Price 3</th>
							  <th>Price 4</th>
						  	<?php if($check_proddetail == 'skus') { ?>
							  <th>Weight</th>
							  <th>Width</th>
							  <th>Length</th>
							  <th>Depth</th>
							  <?php } ?>
							  <th style="display: block; width: 50px; padding: 9px;">Stock</th>
						  </tr>
					  </thead>   
					  <tbody>
						<?php if(empty($productlists)) { ?>
						  <tr valign="middle">
						    <td colspan="8" valign="middle" style="text-align: center;"><strong>There is no data</strong></td>
						  </tr>
						<?php } else { ?>
							<?php $number = 1; ?>
						  <?php foreach($productlists as $productlist) { ?>

							<tr>
								<?php 
								if($check_proddetail == 'skus') 
								{
									$nama = $productlist['value'];
								} else {
									$nama = $productlist['name'];
								} 
								?>
								<td width="20"><?php echo $number; ?></td>
								<td><?php echo $productlist['code'] ?></td>
								<td><?php echo $nama; ?></td>
								<td class="td-manage-long"><?php echo $productlist['price01'] ?></td>
								<td class="td-manage-long"><?php echo $productlist['price02'] ?></td>
								<td class="td-manage-long"><?php echo $productlist['price03'] ?></td>
								<td class="td-manage-long"><?php echo $productlist['price04'] ?></td>
								<?php if($check_proddetail == 'skus') { ?>
								<td class="td-manage-small"><?php echo $productlist['weight'] ?></td>
								<td class="td-manage-small"><?php echo $productlist['width'] ?></td>
								<td class="td-manage-small"><?php echo $productlist['length'] ?></td>
								<td class="td-manage-small"><?php echo $productlist['depth'] ?></td>
								<?php } ?>
								<td class="td-manage-small" style="padding: 7px;"><?php echo $productlist['stock'] ?></td>
							</tr>
							<?php $number++ ?>
						  <?php } ?>
						<?php } ?>
					  </tbody>
					</table>
					<?php if($mode != 'print') { ?>
					<a href="<?php echo 'reportproducts'.URL::query(array('mode'=>'print')) ?>" target="_new" title="Print"><?php echo HTML::image('assets/global/images/print.png')?></a>
					<?php } ?>
				</div>
			</div>
		</div>
		<!-- Product Table End -->
</div>